import axios from '@/libs/api.request'
import { getToken } from '@/libs/util'
// =============== news-system/advertisements/list.vue =========================
let auth_token = getToken();
//网点列表
export const getTableData = (page_current, page_size, searchData) => {
  return axios.request({
    url: 'api/v1.cuser.dot/index',
    params: {
      page_current: page_current,
      page_size: page_size,
      auth_token:auth_token,
      search_data: JSON.stringify(searchData)
    },
    method: 'get'
  })
}

export const addDot = (formData) => {
  formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.cuser.dot/create',
    data:formData,
    method: 'post'
  })
}

export const editDot = (formData) => {
  formData.auth_token = auth_token;
  return axios.request({
    url: 'api/v1.cuser.dot/update',
    data:formData,
    method: 'post'
  })
}

export const getInfo = (dot_id) => {
  return axios.request({
    url: 'api/v1.cuser.dot/read',
    params: {
      dot_id: dot_id,
      auth_token:auth_token,
    },
    method: 'get'
  })
}

export const dotRate = (dot_id) => {
  return axios.request({
    url: 'api/v1.cuser.dot/rate_index',
    params: {
      dot_id: dot_id,
      auth_token:auth_token,
      is_pages:0
    },
    method: 'get'
  })
}

export const checkDot = (lon,lat,point_list) => {
	 let formData={
    	  lon:lon,
    	  lat:lat,
    	  point_list,
    	  auth_token:auth_token,
   };
	
  return axios.request({
    url: 'api/v1.cuser.dot/check_dot',
    data:formData,
    method: 'post'
  })
}

export const delDot = (dot_id) => {
	 let formData={
    	  dot_id:dot_id,
    	  auth_token:auth_token,
   };
	
  return axios.request({
    url: 'api/v1.cuser.dot/delete',
    data:formData,
    method: 'post'
  })
}
